package com.hao.wms.query;

import com.hao.wms.util.DateUtil;

import java.util.Date;

public class OrderBillQueryObject extends QueryObject {
    private Date beginDate;
    private Date endDate;
    private Long supplierId = -1L;
    private int status = -1;

    public Date getBeginDate() {
        return beginDate;
    }

    public void setBeginDate(Date beginDate) {
        this.beginDate = beginDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public Long getSupplierId() {
        return supplierId;
    }

    public void setSupplierId(Long supplierId) {
        this.supplierId = supplierId;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    @Override
    public void customerQuery() {
        if (beginDate != null) {
            addQuery("obj.vdate >= ?", DateUtil.getBeginDate(beginDate));
        }
        if (endDate != null) {
            addQuery("obj.vdate <= ?", DateUtil.getEndDate(endDate));
        }
        if (supplierId > 0) {
            addQuery("obj.supplier.id = ?", supplierId);
        }
        if (status >= 0) {
            addQuery("obj.status = ?", status);
        }
    }

}
